function snap=newsnapshot(snapshot_file,varargin)
% newsnapshot: Create a snapshot object for later auto generation of snapshot files
%
% SYNTAX:
%   ret = newsnapshot(snapshot_file,varargin)
%   Return created snapshot object.
%   

%   Author: Hongbin Ma
%   Last updated: 2009-6-2 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

snap=struct('type','MADS.Snapshot',varargin{:});
if isempty(find(snapshot_file=='%')),
    snapshot_file=[snapshot_file,'-%d'];
end;
snap.filename=snapshot_file;
snap=set_field(snap,'handle',[]);
snap=set_field(snap,'options','-r0');
snap=set_field(snap,'number',0);
snap=set_field(snap,'interval',1);
snap=set_field(snap,'format','jpeg');
snap=set_field(snap,'dir','snapshot/');
mkdir(snap.dir);
